/*

METOO and MOIAUSSI! (C) Copyright Bill Buckels 1990 - 2008.
All rights reserved.
Apple //e ProDOS 8 Version 2.0

Written in Manx Aztec C65 Version 3.2b
MS-DOS cross-development environment

*/

/* initialization module */

#include "me2.h"

ovmain(screenmode)
unsigned screenmode;
    {
      int fh;
      scr_clear();
      setcrtmode(screenmode);
      if(screenmode==TEXTMODE) {
		  if (mouseflag == 0)mouseoff();
		  _exit();
	  }

   /* attempt to open the font file */
   /* if there is a problem assume the disk needs to be flipped */
   /* wait for a key press */
   /* if there is still a problem abort the program */

   mouseinit();


   if((fh = open("FATFONT.FNT",O_RDONLY,0xc3))==-1)
   {
    getch();
    if((fh = open("FATFONT.FNT",O_RDONLY,0xc3))==-1)
    {
     setcrtmode(TEXTMODE);
     if (mouseflag == 0)mouseoff();
     _exit();
     }
    read(fh,(char *)0x0c00,1096);
    close(fh);
    fh = open("OLDIES.BIN",O_RDONLY,0xc3);
    read(fh,(char *)0x4000,0x2000);
    close(fh);
   }
   else
   {
    read(fh,(char *)0x0c00,1096);
    close(fh);
     }
    return 0;
}